#include "block.h"

void Block::draw() {	
	float direction = (getBody()->a)* rToDeg;
	float x = getBody()->p.x;
	float y = getBody()->p.y;

	glTranslatef(x, y, 0.0);
	glRotatef(direction, 0.0, 0.0, 1.0);

	glColor4f(r, g, b, 1.0);
	
	glBegin(GL_POLYGON_SMOOTH); {
		glBegin(GL_POLYGON); {
			for (int i = 0; i < numVertii_; i++) {
				glVertex2f(vertii_[i].x, vertii_[i].y);
			}
		} 
		glEnd();
	}
	glEnd();

	glRotatef(-direction, 0.0, 0.0, 1.0);
	glTranslatef(-x, -y, 0.0);
}